package cn.iocoder.yudao.module.cook.dal.mysql.caidan;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.cook.dal.dataobject.caidan.CaidanDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.cook.controller.admin.caidan.vo.*;

/**
 * 食谱菜单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CaidanMapper extends BaseMapperX<CaidanDO> {

    default PageResult<CaidanDO> selectPage(CaidanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CaidanDO>()
                .eqIfPresent(CaidanDO::getParentId, reqVO.getParentId())
                .likeIfPresent(CaidanDO::getName, reqVO.getName())
                .eqIfPresent(CaidanDO::getDescription, reqVO.getDescription())
                .eqIfPresent(CaidanDO::getSort, reqVO.getSort())
                .eqIfPresent(CaidanDO::getStatus, reqVO.getStatus())
                .orderByDesc(CaidanDO::getId));
    }

    default List<CaidanDO> selectList(CaidanListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CaidanDO>()
                .likeIfPresent(CaidanDO::getName, reqVO.getName())
                .eqIfPresent(CaidanDO::getStatus, reqVO.getStatus()));
    }
}